local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.BaseComponent());
local BigNumberHelper = _G.ClientOHOH.load.BigNumberHelper();



function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);

    self.HpLable=self.parent:WaitForChild_Loop("anchor.Attachment.BillboardGui.HP.num")
    self.HpScale=self.parent:WaitForChild_Loop("anchor.Attachment.BillboardGui.HP.scale")

    self.parent.HurtEvent:Connect(function()
		self:Upd()
	end)
    
    self.parent.RebornEvent:Connect(function()
		self:Upd()
	end)

    

    self:Upd()

end;

function M.Upd(self)
    local max=  self.parent.maxHp
    local hp= self.parent.hp
    self.HpLable.Text=BigNumberHelper:ToString(hp).."/"..BigNumberHelper:ToString(max)
    self.HpScale.Size=UDim2.fromScale(hp/max,1)
end

return M